package com.liuweiheng.cloud.thread;

/**
 * 实现线程方法二：实现Runnable接口
 * @author lwh
 * @since 2021/5/10
 */
public class MyRunnable implements Runnable{
    @Override
    public void run() {
        System.out.println("线程" + Thread.currentThread().getName() + "启动");
    }

    public static void main(String[] args) {
        new Thread(new MyRunnable()).start();

        // JDK1.8新特性：函数式编程
        new Thread(() -> {
            System.out.println("线程" + Thread.currentThread().getName() + "启动");
        }).start();
    }

}
